package com.example.spider.provider.why10w.deprecated.why10org;

import com.example.spider.provider.why10w.deprecated.why10org.task.Why10orgListTask;

/**
 * 爬虫任务创建器
 *
 * @author lym
 */
public class Why10orgListTaskFactory {

    public static Why10orgListTask createPageTask(String firstCategory, String secondCategory, int pageNo) {
        String baseUrl = "http://www.10why.org/" + firstCategory + "/" + secondCategory;
        return new Why10orgListTask()
                .setFirstCategory(firstCategory)
                .setSecondCategory(secondCategory)
                .setPage(pageNo)
                .setUrl(pageNo == 1 ? baseUrl : baseUrl + "/page/" + pageNo);
    }

}
